<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../css/H-ui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <title></title>
</head>
<body>
<article class="page-container tradeOrderDetail">
    <form id="custFrom" method="post" class="form form-horizontal">
        <div class="option1">

        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/js/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/js/H-ui.js"></script>
<script type="text/javascript" src="/js/H-ui.min.js"></script>
<script type="text/javascript" src="/js/postJson.js"></script>
<script type="text/javascript" src="/js/root.js"></script>
<!--/_footer 作为公共模版分离出去-->
<script>
    var tradeOrderId = parent.$("#orderDetail").attr("dataId");
    var orderDetailId = parent.$("#orderDetail").attr("detailId");
    var custName = parent.$("#orderDetail").attr("dataCustname");
    //根据订单Id获取订单详情列表
    function getTradeOrderDetailByOrderId(){
        var jsonObj
        if(orderDetailId == null){
            var url = "/tradeOrderController/getTradeOrderDetailByOrderId"
            jsonObj = {
                "tradeOrderId":tradeOrderId
            }
        }else{
            var url = "/tradeOrderController/getTradeOrderDetailById"
            jsonObj = {
                "orderDetailId":orderDetailId
            }
        }
        $.ajax({
            url:url,
            type:"POST",
            data: jsonObj,
            dataType:"json",
            async:false,
            success:function(msg){
                // console.log(JSON.stringify(msg));
                var _html = '';
                if(msg.success){
                    if(orderDetailId == null){
                        $.each(msg.data, function (i, n) {
                            _html += '<div class="row cl marginTB">'
                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>业务种类：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<select class="businessType_'+i+'" name="businessType" id="businessType" disabled="disabled" style="width: 183px;">'
                            _html += '<option value="">请选择</option>'
                            _html += '<option value="10">游客购买</option>'
                            _html += '<option value="11">vip复购</option>'
                            _html += '<option value="12">配送商复购</option>'
                            _html += '<option value="21">注册VIP</option>'
                            _html += '<option value="22">注册配送商</option>'
                            _html += '</select>'
                            _html += '</div>'
                            _html += '</div>'

                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>订单ID：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+n.tradeOrderId+'" placeholder="" id="tradeOrderId" name="tradeOrderId" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '</div>'

                            _html += '<div class="row cl marginTB">'
                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>客户姓名：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+custName+'" placeholder="" id="custName" name="custName" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'

                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>产品名称：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+n.productName+'" placeholder="" id="productName" name="productName" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '<div class="row cl marginTB">'
                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>商品数量：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+n.count+'" placeholder="" id="count" name="count" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'

                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>购买单价：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+n.price+'" placeholder="" id="price" name="price" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '<div class="row cl marginTB">'
                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>小计金额：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+n.amount+'" placeholder="" id="amount" name="amount" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'

                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>配送积分：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+n.cloudPoint+'" placeholder="" id="cloudPoint" name="cloudPoint" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '<div class="row cl marginTB">'
                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>配送运费：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+n.priceCarriage+'" placeholder="" id="priceCarriage" name="priceCarriage" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'

                            _html += '<div class="row cl col-xs-6 col-sm-6">'
                            _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>创建时间：</label>'
                            _html += '<div class="formControls col-xs-8 col-sm-7">'
                            _html += '<input type="text" class="input-text bgeee" value="'+TimeHours(n.createTime)+'" placeholder="" id="createTime" name="createTime" readonly="readonly">'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '</div>'
                            _html += '<br/>'
                            _html += '<hr/>'
                            _html += '<br/>'
                        })
                        $(".option1").empty().append(_html);
                        $.each(msg.data, function (i, n) {
                            $(".businessType_" + i).find("option[value='" + n.businessType + "']").prop("selected", true);
                        })
                    }else {//根据订单详情ID去查
                        _html += '<div class="row cl marginTB">'
                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>业务种类：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<select class="businessType" name="businessType" id="businessType" disabled="disabled" style="width: 183px;">'
                        _html += '<option value="">请选择</option>'
                        _html += '<option value="10">游客购买</option>'
                        _html += '<option value="11">vip复购</option>'
                        _html += '<option value="12">配送商复购</option>'
                        _html += '<option value="21">注册VIP</option>'
                        _html += '<option value="22">注册配送商</option>'
                        _html += '</select>'
                        _html += '</div>'
                        _html += '</div>'

                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>订单ID：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+msg.data.tradeOrderId+'" placeholder="" id="tradeOrderId" name="tradeOrderId" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '</div>'

                        _html += '<div class="row cl marginTB">'
                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>客户姓名：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+custName+'" placeholder="" id="custName" name="custName" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'

                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>名称：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+msg.data.productName+'" placeholder="" id="productName" name="productName" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '<div class="row cl marginTB">'
                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>商品数量：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+msg.data.count+'" placeholder="" id="count" name="count" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'

                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>购买单价：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+msg.data.price+'" placeholder="" id="price" name="price" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '<div class="row cl marginTB">'
                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>小计金额：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+msg.data.amount+'" placeholder="" id="amount" name="amount" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'

                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>配送积分：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+msg.data.cloudPoint+'" placeholder="" id="cloudPoint" name="cloudPoint" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '<div class="row cl marginTB">'
                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>配送运费：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+msg.data.priceCarriage+'" placeholder="" id="priceCarriage" name="priceCarriage" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'

                        _html += '<div class="row cl col-xs-6 col-sm-6">'
                        _html += '<label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>创建时间：</label>'
                        _html += '<div class="formControls col-xs-8 col-sm-7">'
                        _html += '<input type="text" class="input-text bgeee" value="'+TimeHours(msg.data.createTime)+'" placeholder="" id="createTime" name="createTime" readonly="readonly">'
                        _html += '</div>'
                        _html += '</div>'
                        _html += '</div>'
                        $(".option1").empty().append(_html);
                        $(".businessType").find("option[value='" + msg.data.businessType + "']").prop("selected", true);
                    }
                }
            }
        })
    }

    getTradeOrderDetailByOrderId()

</script>
</body>
</html>